package com.example.schoolexam2.mapper;

import com.example.schoolexam2.dto.EmployeeDto;
import com.example.schoolexam2.entity.Employee;
import com.example.schoolexam2.entity.EmployeeTemporaryBean;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EmplMapper {
    //教师表导入
    @Insert("insert into employee(employee_Id,id_Number,sex,employee_Name) value(#{employeeId},#{idNumber},#{sex},#{employeeName})")
    int employeeIncreases(EmployeeTemporaryBean employeeTemporaryBean);
    @Select("select * from employee where employee_Id= #{employeeId}")
    Employee employeePersonal(String employeeId);
    //假删除
    @Update("UPDATE employee SET isuser = #{isUser}  WHERE employee_Id= #{employeeId}")
    int employeeDelete(String employeeId,int isUser);
    @Insert("insert into employee(employee_Id,id_Number,password,Phone_Number,department,sex,employee_Name,photo,email) values(#{employeeId},#{idNumber},#{password},#{photoNumber},#{department},#{sex},#{employeeName},#{photo},#{email})")
    int employeeIncrease(EmployeeDto employeeDto);
    @Update("UPDATE employee SET password=#{password},Phone_Number=#{photoNumber},email=#{email},photo=#{photo} WHERE employee_id=#{employeeId}")
    int employeeUpdate(EmployeeDto dto);
    @Select("select * from employee where employee_Name LIKE '%' #{fuzzy} '%' ")
    List<Employee> employeeFuzzy(String fuzzy);
    //真删除
    @Delete("DELETE FROM employee WHERE employee_Id=#{employeeId}")
    int employeeDeleteTrue(String employeeId);

    @Select("select departmentId from employee where employee_Id =#{employedId}")
    String findDepartmentByEmplyee(String employedId);
}
